home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 48 / PC Gamer IT CD 48 1-2.iso / age2 / AoE2demo.exe / 1033 / CABFILE / MSGAME.CAB / Data / gamedata.drs / Unnamed File 000001.bina next >
Text File  |  1999-10-01  |  29KB  |  1,332 lines

  1. ;starting loads
  2. (load "petersen civ loads")
  3. (load "petersen difficulty loads")
  4. (load "petersen gather")
  5.  
  6. (load "petersen upgrades")
  7. (load "petersen castle")
  8. (load "petersen full tech")
  9.  
  10. (load "petersen rush")
  11.  
  12. (defrule
  13.     (true)
  14. =>
  15.     (set-goal military-parity YES)    ;goal 3
  16.     (set-goal attack-control NO)    ;goal 4
  17.     (set-goal resource-needed NO)    ;goal 5
  18.  
  19.     (set-goal rush-control NOTICE)    ;goal 6
  20.     (set-goal secondary-build NO)    ;goal 8
  21.     (set-goal combat-arm NOTICE)    ;goal 11
  22.  
  23.     (set-goal soldiers-available NO);goal 10
  24.     (set-goal combat-supp UNIT20)    ;goal 12
  25.     (set-goal age-advancement NO)    ;goal 14
  26.  
  27.     (disable-self)
  28. )
  29.  
  30. (defrule
  31.     (true)
  32. =>
  33.     (set-goal upgrade-conflict NO)    ;goal 16
  34.     (set-goal wonder-attempt MAYBE)    ;goal 20
  35.     (set-goal enemy-soldiers NO)    ;goal 26
  36.  
  37.     (set-goal get-mad NO)            ;goal 28
  38.     (set-goal siege-available YES)    ;goal 34
  39.     (disable-self)
  40. )
  41.  
  42. ;========================DARK AGE RULES
  43. (defrule
  44.     (true)
  45. =>
  46.     (set-strategic-number sn-coop-share-information 1)
  47.     (set-strategic-number sn-coop-share-attacking 1)
  48.     (set-strategic-number sn-maximum-town-size 15)
  49.  
  50.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  51.     (set-strategic-number sn-zero-priority-distance 250)
  52.     (set-strategic-number sn-blot-exploration-map 0)
  53.  
  54.     (set-strategic-number sn-attack-intelligence 1)
  55.     (set-strategic-number sn-gather-defense-units 1)
  56.     (set-strategic-number sn-defense-distance 2)
  57.  
  58.     (set-strategic-number sn-maximum-gaia-attack-response 2)
  59.     (set-strategic-number sn-ignore-attack-group-under-attack 0)
  60.     (set-strategic-number sn-minimum-boar-hunt-group-size 5)
  61.     (disable-self)
  62. )
  63.  
  64. (defrule
  65.     (true)
  66. =>
  67.     (set-strategic-number sn-stone-dropsite-distance 3)
  68.     (set-strategic-number sn-gold-dropsite-distance 3)
  69.     (set-strategic-number sn-retask-gather-amount 20)
  70.     (set-strategic-number sn-camp-max-distance 20)
  71.  
  72.     (set-strategic-number sn-mill-max-distance 20)
  73.     (set-strategic-number sn-enemy-sighted-response-distance 10)
  74.     (set-strategic-number sn-group-form-distance 10)
  75.  
  76.     (set-strategic-number sn-allow-civilian-defense 1)
  77.     (disable-self)
  78. )
  79.  
  80. (defrule
  81.     (true)
  82. =>
  83.     (set-strategic-number sn-town-defend-priority 1)
  84.     (set-strategic-number sn-gold-defend-priority 2)
  85.     (set-strategic-number sn-stone-defend-priority 3)
  86.  
  87.     (set-strategic-number sn-forage-defend-priority 0)
  88.     (set-strategic-number sn-relic-defend-priority 0)
  89.     (set-strategic-number sn-cap-civilian-builders 8)
  90.  
  91.     (set-strategic-number sn-cap-civilian-gatherers 100)
  92.     (set-strategic-number sn-minimum-civilian-explorers 0)
  93.     (set-strategic-number sn-cap-civilian-explorers 0)
  94.  
  95.     (set-strategic-number sn-percent-civilian-explorers 0)
  96.     (disable-self)
  97. )
  98.  
  99. (defrule
  100.     (true)
  101. =>
  102.     (set-strategic-number sn-maximum-wood-drop-distance 20)
  103.     (set-strategic-number sn-maximum-food-drop-distance 20)
  104.     (set-strategic-number sn-maximum-hunt-drop-distance 40)
  105.  
  106.     (set-strategic-number sn-maximum-fish-boat-drop-distance 30)
  107.     (set-strategic-number sn-maximum-gold-drop-distance 20)
  108.     (set-strategic-number sn-maximum-stone-drop-distance 20)
  109.     (disable-self)
  110. )
  111.  
  112. ;start exploring
  113. (defrule
  114.     (or
  115.         (game-time > 600)
  116.         (and
  117.             (starting-resources < high-resources)
  118.             (difficulty > hardest)
  119.         )
  120.     )
  121. =>
  122.     (set-strategic-number sn-percent-civilian-builders 15)
  123.     (set-strategic-number sn-percent-civilian-gatherers 85)
  124.     (disable-self)
  125. )
  126.  
  127. (defrule
  128.     (or
  129.         (starting-resources == high-resources)
  130.         (difficulty == hardest)
  131.     )
  132. =>
  133.     (set-strategic-number sn-percent-civilian-builders 85)
  134.     (set-strategic-number sn-percent-civilian-gatherers 15)
  135.     (disable-self)
  136. )
  137.  
  138. ; explore a bit at need
  139. (defrule
  140.     (game-time < 600)
  141.     (military-population == 0)
  142.     (civilian-population < 15)
  143.     (or
  144.         (dropsite-min-distance food == -1)
  145.         (civilian-population > 10)
  146.     )
  147. =>
  148.     (set-strategic-number sn-minimum-civilian-explorers 1)
  149.     (set-strategic-number sn-cap-civilian-explorers 1)
  150.     (set-strategic-number sn-percent-civilian-explorers 5)
  151.     (set-strategic-number sn-percent-civilian-builders 15)
  152.     (set-strategic-number sn-percent-civilian-gatherers 80)
  153. )
  154.  
  155. ; Shut the explorers off when we get enough food
  156. (defrule
  157.     (strategic-number sn-percent-civilian-explorers > 0)
  158.     (or
  159.         (or
  160.             (game-time > 900)
  161.             (dropsite-min-distance food > -1)
  162.         )
  163.         (military-population > 0)
  164.     )
  165. =>
  166.     (set-strategic-number sn-percent-civilian-explorers 0)
  167.     (set-strategic-number sn-minimum-civilian-explorers 0)
  168.     (set-strategic-number sn-cap-civilian-explorers 0)
  169.     (set-strategic-number sn-percent-civilian-builders 15)
  170.     (set-strategic-number sn-percent-civilian-gatherers 85)
  171. )
  172.  
  173. (defrule
  174.     (or
  175.         (players-current-age any-enemy > feudal-age)
  176.         (players-military-population any-enemy > 2)
  177.     )
  178. =>
  179.     (set-strategic-number sn-allow-civilian-defense 0)
  180.     (disable-self)
  181. )
  182.  
  183. ; villager count
  184. (defrule
  185.     (current-age == dark-age)
  186.     (civilian-population < civ-dark)
  187.     (nor
  188.         (goal rush-control 2)
  189.         (or
  190.             (goal rush-control BOOMING)
  191.             (goal rush-control FEEDING)
  192.         )
  193.     )
  194.     (can-train villager)
  195. =>
  196.     (train villager)
  197. )
  198.  
  199. (defrule
  200.     (current-age == dark-age)
  201.     (or
  202.         (and
  203.             (or
  204.                 (goal rush-control 2)
  205.                 (goal rush-control FEEDING)
  206.             )
  207.             (civilian-population < civ-dark-rush)
  208.         )
  209.         (and
  210.             (goal rush-control BOOMING)
  211.             (civilian-population < civ-feudal)
  212.         )        
  213.     )
  214.     (can-train villager)
  215. =>
  216.     (train villager)
  217. )
  218.  
  219. ;maintain housing
  220. (defrule
  221.     (difficulty <= moderate)
  222.     (housing-headroom < 5)
  223.     (population-headroom > 0)
  224.     (can-build house)
  225. =>
  226.     (build house)
  227. )
  228.  
  229. #load-if-defined DIFFICULTY-EASIEST
  230. (defrule
  231.     (military-population < 10)
  232.     (housing-headroom < 5)
  233.     (population-headroom > 0)
  234.     (can-build house)
  235. =>
  236.     (build house)
  237. )
  238. #end-if
  239.  
  240. #load-if-defined DIFFICULTY-EASY
  241. (defrule
  242.     (military-population < civ-dark-rush)
  243.     (housing-headroom < 5)
  244.     (population-headroom > 0)
  245.     (can-build house)
  246. =>
  247.     (build house)
  248. )
  249. #end-if
  250.  
  251. ;maintain a town center
  252. (defrule
  253.     (game-time > 45)
  254.     (building-type-count town-center < 1)
  255.     (can-build town-center)
  256. =>
  257.     (build town-center)
  258. )
  259.  
  260. ; Build a mill when we find food
  261. (defrule
  262.     (building-type-count-total house > 0)
  263.     (building-type-count-total mill == 0)
  264.     (or
  265.         (resource-found food)
  266.         (game-time > 900)
  267.     )
  268.     (can-build mill)
  269. =>
  270.     (build mill)
  271. )
  272.  
  273. (defrule
  274.     (game-time > 90)
  275.     (resource-found wood)
  276.     (building-type-count-total house > 0)
  277.     (building-type-count-total lumber-camp == 0)
  278.     (can-build lumber-camp)
  279. =>
  280.     (build lumber-camp)
  281. )
  282.  
  283. ;build farms
  284. (defrule
  285.     (building-type-count-total lumber-camp > 0)
  286.     (building-type-count-total mill > 0)
  287.     (idle-farm-count <= 1)
  288.     (sheep-and-forage-too-far)
  289.     (can-build farm)
  290.     (not (goal wonder-attempt YES) )
  291. =>
  292.     (build farm)
  293. )
  294.  
  295. (defrule
  296.     (building-type-count-total barracks == 0)
  297.     (can-build-with-escrow barracks)
  298.     (or
  299.         (and
  300.             (building-type-count-total lumber-camp > 0)
  301.             (building-type-count-total mill > 0)
  302.         )
  303.         (current-age > dark-age)
  304.     )
  305. =>
  306.     (release-escrow wood)
  307.     (build barracks)
  308. )
  309.  
  310. (defrule
  311.     (building-type-count-total barracks == 1)
  312.     (can-build-with-escrow barracks)
  313.     (goal rush-control RUSHING)
  314.     (not (goal 1 10) )
  315. =>
  316.     (release-escrow wood)
  317.     (build-forward barracks)
  318. )
  319.  
  320. (defrule
  321.     (current-age == dark-age)
  322.     (building-type-count-total mining-camp == 0)
  323.     (goal resource-needed GOLD)
  324.     (resource-found gold)
  325.     (can-build mining-camp)
  326. =>
  327.     (build mining-camp)
  328. )
  329.  
  330.  
  331. ;=======================FEUDAL AGE RULES
  332. (defrule
  333.     (current-age >= feudal-age)
  334. =>
  335.     (set-strategic-number sn-maximum-town-size feudal-town-size)
  336.     (set-strategic-number sn-percent-civilian-builders 15)
  337.     (set-strategic-number sn-percent-civilian-gatherers 85)
  338.  
  339.     (set-strategic-number sn-camp-max-distance 35)
  340.     (set-strategic-number sn-mill-max-distance 35)
  341.     (set-strategic-number sn-group-form-distance 20)
  342.  
  343.     (set-strategic-number sn-enemy-sighted-response-distance 10)
  344.     (set-strategic-number sn-ignore-attack-group-under-attack 1)
  345.     (disable-self)
  346. )
  347.  
  348. (defrule
  349.     (current-age >= feudal-age)
  350. =>
  351.     (set-goal combat-supp UNIT20)
  352.     (set-goal age-advancement NO)
  353.     (enable-timer t-production 1)
  354.     (enable-timer t-lumbercamp 1)
  355.     (disable-timer t-ageup)
  356.     (disable-self)
  357. )
  358.  
  359. (defrule
  360.     (current-age == feudal-age)
  361.     (current-age-time < 600)
  362.     (wood-amount > 500)
  363. =>
  364.     (set-strategic-number sn-percent-civilian-builders 50)
  365.     (set-strategic-number sn-percent-civilian-gatherers 50)
  366.     (disable-self)
  367. )
  368.  
  369. (defrule
  370.     (current-age == feudal-age)
  371.     (current-age-time >= 600)
  372. =>
  373.     (set-strategic-number sn-percent-civilian-builders 15)
  374.     (set-strategic-number sn-percent-civilian-gatherers 85)
  375.     (disable-self)
  376. )
  377.  
  378. ; villager count
  379. (defrule
  380.     (current-age == feudal-age)
  381.     (civilian-population < civ-feudal)
  382.     (nor
  383.         (goal rush-control 3)
  384.         (or
  385.             (goal rush-control BOOMING)
  386.             (goal rush-control FEEDING)
  387.         )
  388.     )
  389.     (can-train villager)
  390. =>
  391.     (train villager)
  392. )
  393.  
  394. (defrule
  395.     (current-age == feudal-age)
  396.     (or
  397.         (and
  398.             (goal rush-control 3)
  399.             (civilian-population < civ-dark)
  400.         )
  401.         (and
  402.             (or
  403.                 (goal rush-control BOOMING)
  404.                 (goal rush-control FEEDING)
  405.             )
  406.             (civilian-population < civ-castle)
  407.         )
  408.     )            
  409.     (can-train villager)
  410. =>
  411.     (train villager)
  412. )
  413.  
  414. ;periodically task idle guys, so they don't clog up production
  415. (defrule
  416.     (timer-triggered t-lumbercamp)
  417.     (strategic-number sn-task-ungrouped-soldiers == 0)
  418. =>
  419.     (set-strategic-number sn-task-ungrouped-soldiers 1)
  420. )
  421.  
  422. (defrule
  423.     (timer-triggered t-lumbercamp)
  424.     (strategic-number sn-task-ungrouped-soldiers == 1)
  425. =>
  426.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  427. )
  428.  
  429. ; Build camps at need
  430. (defrule
  431.     (timer-triggered t-lumbercamp)
  432.     (current-age >= feudal-age)
  433.     (resource-found wood)
  434.     (dropsite-min-distance wood > 5)
  435.     (can-build lumber-camp)
  436. =>
  437.     (build lumber-camp)
  438. )
  439.  
  440. (defrule
  441.     (current-age >= feudal-age)
  442.     (resource-found gold)
  443.     (building-type-count-total mining-camp == 0)
  444.     (can-build-with-escrow mining-camp)
  445. =>
  446.     (release-escrow wood)
  447.     (build mining-camp)
  448. )
  449.  
  450. (defrule
  451.     (current-age >= feudal-age)
  452.     (resource-found stone)
  453.     (building-type-count-total mining-camp == 1)
  454.     (can-build-with-escrow mining-camp)
  455. =>
  456.     (release-escrow wood)
  457.     (build mining-camp)
  458. )
  459.  
  460. (defrule
  461.     (timer-triggered t-lumbercamp)
  462.     (current-age >= feudal-age)
  463.     (building-type-count-total market > 0)
  464.     (building-type-count-total blacksmith > 0)
  465.     (building-type-count-total mining-camp >= 1)
  466.     (building-type-count-total mining-camp < mining-count)
  467.     (resource-found gold)
  468.     (resource-found stone)
  469.     (or
  470.         (dropsite-min-distance gold > 7)
  471.         (dropsite-min-distance stone > 7)
  472.     )
  473.     (can-build mining-camp)
  474. =>
  475.     (build mining-camp)
  476. )
  477.  
  478. (defrule
  479.     (timer-triggered t-lumbercamp)
  480. =>
  481.     (disable-timer t-lumbercamp)
  482.     (enable-timer t-lumbercamp 30)
  483. )
  484.  
  485. (defrule
  486.     (building-type-count-total archery-range == 0)
  487.     (or
  488.         (goal rush-control 3)
  489.         (goal rush-control RUSHING)
  490.     )
  491.     (or
  492.         (or
  493.             (goal combat-arm CAVARCHER)
  494.             (goal combat-arm ARCHER)
  495.         )
  496.         (or
  497.             (goal pre-unique-arm CAVARCHER)
  498.             (goal pre-unique-arm ARCHER)
  499.         )
  500.     )
  501.     (can-build-with-escrow archery-range)
  502. =>
  503.     (release-escrow wood)
  504.     (build archery-range)
  505. )
  506.  
  507. (defrule
  508.     (goal combat-arm LIGHTCAV)
  509.     (building-type-count-total stable == 0)
  510.     (or
  511.         (goal rush-control 3)
  512.         (goal rush-control RUSHING)
  513.     )
  514.     (can-build-with-escrow stable)
  515. =>
  516.     (release-escrow wood)
  517.     (build stable)
  518. )
  519.  
  520. ;feudal age market -- always keep a market handy!
  521. (defrule
  522.     (building-type-count-total market == 0)
  523.     (can-build-with-escrow market)
  524. =>
  525.     (release-escrow wood)
  526.     (build market)
  527. )
  528.  
  529. ;get a blacksmith
  530. (defrule
  531.     (building-type-count-total market > 0)
  532.     (building-type-count-total barracks > 0)
  533.     (building-type-count-total blacksmith == 0)
  534.     (can-build-with-escrow blacksmith)
  535. =>
  536.     (release-escrow wood)
  537.     (build blacksmith)
  538. )
  539.  
  540. (defrule
  541.     (building-type-count-total market > 0)
  542.     (building-type-count-total archery-range == 0)
  543.     (or
  544.         (or
  545.             (goal combat-arm CAVARCHER)
  546.             (goal combat-arm ARCHER)
  547.         )
  548.         (or
  549.             (or
  550.                 (goal combat-supp CAVARCHER)
  551.                 (goal combat-supp ARCHER)
  552.             )
  553.             (or
  554.                 (goal pre-unique-arm CAVARCHER)
  555.                 (goal pre-unique-arm ARCHER)
  556.             )
  557.         )
  558.     )
  559.     (can-build-with-escrow archery-range)
  560. =>
  561.     (release-escrow wood)
  562.     (build archery-range)
  563. )
  564.  
  565. (defrule
  566.     (building-type-count-total market > 0)
  567.     (building-type-count-total stable == 0)
  568.     (or
  569.         (or
  570.             (goal combat-arm CAVALRY)
  571.             (goal combat-arm LIGHTCAV)
  572.         )
  573.         (or
  574.             (or
  575.                 (goal combat-supp CAVALRY)
  576.                 (goal combat-supp LIGHTCAV)
  577.             )
  578.             (or
  579.                 (goal pre-unique-arm CAVALRY)
  580.                 (goal pre-unique-arm LIGHTCAV)
  581.             )
  582.         )
  583.     )
  584.     (can-build-with-escrow stable)
  585. =>
  586.     (release-escrow wood)
  587.     (build stable)
  588. )
  589.  
  590. (defrule
  591.     (current-age >= feudal-age)
  592.     (current-age-time > 300)
  593.     (building-type-count-total mill < feudal-mill-count)
  594.     (wood-amount > 400)
  595.     (can-build mill)
  596. =>
  597.     (build mill)
  598. )
  599.  
  600. (defrule
  601.     (cc-players-building-type-count any-ally market > 0)
  602.     (unit-type-count-total trade-cart == 0)
  603.     (wood-amount > 300)
  604.     (gold-amount > 300)
  605.     (nor
  606.         (town-under-attack)
  607.         (and
  608.             (goal 1 10)
  609.             (not (map-type team-islands) )
  610.         )
  611.     )
  612.     (can-train trade-cart)
  613. =>
  614.     (train trade-cart)
  615.     (disable-self)
  616. )
  617.  
  618. (defrule
  619.     (current-age == imperial-age)
  620.     (cc-players-building-type-count any-ally market > 0)
  621.     (unit-type-count-total trade-cart == 0)
  622.     (wood-amount > 300)
  623.     (gold-amount > 300)
  624.     (nor
  625.         (town-under-attack)
  626.         (and
  627.             (goal 1 10)
  628.             (not (map-type team-islands) )
  629.         )
  630.     )
  631.     (can-train trade-cart)
  632. =>
  633.     (train trade-cart)
  634.     (disable-self)
  635. )
  636.  
  637. (defrule
  638.     (cc-players-building-type-count any-ally dock >= 1)
  639.     (unit-type-count-total trade-cog == 0)
  640.     (wood-amount > 300)
  641.     (gold-amount > 300)
  642.     (not (goal 1 0) )
  643.     (can-train trade-cog)
  644. =>
  645.     (train trade-cog)
  646.     (disable-self)
  647. )
  648.  
  649. (defrule
  650.     (current-age == imperial-age)
  651.     (cc-players-building-type-count any-ally dock >= 1)
  652.     (unit-type-count-total trade-cog == 0)
  653.     (wood-amount > 300)
  654.     (gold-amount > 300)
  655.     (not (goal 1 0) )
  656.     (can-train trade-cog)
  657. =>
  658.     (train trade-cog)
  659.     (disable-self)
  660. )
  661.  
  662. ;======================== CASTLE AGE RULES
  663. ;see age advancement rules for strategic number-settings
  664. (defrule
  665.     (current-age >= castle-age)
  666. =>
  667.     (set-strategic-number sn-sentry-distance 4)
  668.     (set-strategic-number sn-maximum-town-size castle-town-size)
  669.     (set-strategic-number sn-percent-civilian-builders 15)
  670.  
  671.     (set-strategic-number sn-percent-civilian-gatherers 85)
  672.     (set-strategic-number sn-blot-exploration-map 1)
  673.     (set-strategic-number sn-camp-max-distance 50)
  674.  
  675.     (set-strategic-number sn-mill-max-distance 50)
  676.     (set-strategic-number sn-group-form-distance 30)
  677.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  678.  
  679.     (set-goal age-advancement NO)
  680.     (disable-timer t-ageup)
  681.  
  682.     (disable-self)
  683. )
  684.  
  685. ; villager count
  686. (defrule
  687.     (current-age == castle-age)
  688.     (civilian-population < civ-castle)
  689.     (nor
  690.         (goal rush-control 4)
  691.         (or
  692.             (goal rush-control BOOMING)
  693.             (goal rush-control FEEDING)
  694.         )
  695.     )
  696.     (can-train villager)
  697. =>
  698.     (train villager)
  699. )
  700.  
  701. (defrule
  702.     (current-age == castle-age)
  703.     (or
  704.         (and
  705.             (goal rush-control 4)
  706.             (civilian-population < civ-feudal)
  707.         )
  708.         (and
  709.             (or
  710.                 (goal rush-control BOOMING)
  711.                 (goal rush-control FEEDING)
  712.             )
  713.             (civilian-population < civ-castle)
  714.         )
  715.     )
  716.     (can-train villager)
  717. =>
  718.     (train villager)
  719. )
  720.  
  721. ;Siege Workshop
  722. (defrule
  723.     (building-type-count-total siege-workshop == 0)
  724.     (can-build-with-escrow siege-workshop)
  725. =>
  726.     (release-escrow wood)
  727.     (build siege-workshop)
  728. )
  729.  
  730. ;University & maintain it
  731. (defrule
  732.     (building-type-count-total university == 0)
  733.     (or
  734.         (building-type-count-total siege-workshop > 0)
  735.         (wood-amount > 500)
  736.     )
  737.     (can-build-with-escrow university)
  738. =>
  739.     (release-escrow wood)
  740.     (build university)
  741. )
  742.  
  743. ; Build a monastery
  744. (defrule
  745.     (building-type-count-total monastery == 0)
  746.     (or
  747.         (goal monk-rating GOOD)
  748.         (or
  749.             (building-type-count-total siege-workshop > 0)
  750.             (wood-amount > 500)
  751.         )
  752.     )
  753.     (not (goal monk-rating NO) )
  754.     (can-build-with-escrow monastery)
  755. =>
  756.     (release-escrow wood)
  757.     (build monastery)
  758. )
  759.  
  760. (defrule
  761.     (goal monk-rating GOOD)
  762.     (building-type-count-total monastery < 2)
  763.     (building-type-count-total siege-workshop > 0)
  764.     (can-build monastery)
  765. =>
  766.     (build monastery)
  767. )
  768.  
  769. (defrule
  770.     (current-age >= castle-age)
  771.     (current-age-time > 300)
  772.     (building-type-count-total mill < castle-mill-count)
  773.     (wood-amount > 500)
  774.     (can-build mill)
  775. =>
  776.     (build mill)
  777. )
  778.  
  779. ;=============================IMPERIAL AGE RULES
  780. ;see age advancement rules for strategic number-settings
  781. (defrule
  782.     (current-age == imperial-age)
  783. =>
  784.     (set-strategic-number sn-maximum-town-size imperial-town-size)
  785.     (set-strategic-number sn-percent-civilian-builders 15)
  786.     (set-strategic-number sn-percent-civilian-gatherers 85)
  787.     (set-strategic-number sn-camp-max-distance 50)
  788.  
  789.     (set-strategic-number sn-mill-max-distance 50)
  790.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  791.  
  792.     (set-goal age-advancement NO)
  793.     (disable-self)
  794. )
  795.  
  796. (defrule
  797.     (current-age == imperial-age)
  798.     (civilian-population < civ-castle)
  799.     (can-train villager)
  800. =>
  801.     (train villager)
  802. )
  803.  
  804. (defrule
  805.     (current-age == imperial-age)
  806.     (population >= pop-cap)
  807.     (unit-type-count villager > civ-castle)
  808. =>
  809.     (delete-unit villager)
  810. )    
  811.  
  812. ;another town center?
  813. (defrule
  814.     (current-age == imperial-age)
  815.     (building-type-count town-center < town-center-count)
  816.     (wood-amount > 400)
  817.     (can-build town-center)
  818. =>
  819.     (build town-center)
  820. )
  821.  
  822. (defrule
  823.     (current-age == imperial-age)
  824.     (current-age-time > 300)
  825.     (building-type-count-total mill < imperial-mill-count)
  826.     (wood-amount > 700)
  827.     (can-build mill)
  828. =>
  829.     (build mill)
  830. )
  831.  
  832. ;****************
  833. ;forward builders!
  834. ; start the run-through for island maps
  835. (defrule
  836.     (goal 1 10)
  837.     (goal rush-control RUSHING)
  838.     (difficulty <= moderate)
  839.     (building-type-count barracks == 1)
  840.     (building-type-count-total blacksmith > 0)
  841.     (strategic-number sn-number-forward-builders == 0)
  842.     (unit-type-count villager >= civ-dark-rush)
  843.     (goal combat-arm INFANTRY)
  844. =>
  845.     (set-strategic-number sn-number-forward-builders 1)
  846. )
  847.  
  848. (defrule
  849.     (goal 1 10)
  850.     (goal rush-control RUSHING)
  851.     (difficulty <= moderate)
  852.     (building-type-count stable == 1)
  853.     (building-type-count-total university > 0)
  854.     (strategic-number sn-number-forward-builders == 0)
  855.     (unit-type-count villager >= civ-dark-rush)
  856.     (or
  857.         (goal combat-arm CAVALRY)
  858.         (goal combat-arm LIGHTCAV)
  859.     )
  860. =>
  861.     (set-strategic-number sn-number-forward-builders 1)
  862. )
  863.  
  864. (defrule
  865.     (goal 1 10)
  866.     (goal rush-control RUSHING)
  867.     (difficulty <= moderate)
  868.     (building-type-count archery-range == 1)
  869.     (building-type-count-total market > 0)
  870.     (strategic-number sn-number-forward-builders == 0)
  871.     (unit-type-count villager >= civ-dark-rush)
  872.     (or
  873.         (goal combat-arm CAVARCHER)
  874.         (goal combat-arm ARCHER)
  875.     )
  876. =>
  877.     (set-strategic-number sn-number-forward-builders 1)
  878. )
  879.  
  880. (defrule
  881.     (goal 1 10)
  882.     (goal rush-control RUSHING)
  883.     (difficulty <= hard)
  884.     (building-type-count siege-workshop == 1)
  885.     (strategic-number sn-number-forward-builders == 0)
  886.     (unit-type-count villager >= civ-dark-rush)
  887.     (or
  888.         (or
  889.             (building-type-count-total archery-range > 1)
  890.             (building-type-count-total castle > 1)
  891.         )
  892.         (or
  893.             (building-type-count-total barracks > 1)
  894.             (building-type-count-total stable > 1)
  895.         )
  896.     )
  897. =>
  898.     (set-strategic-number sn-number-forward-builders 1)
  899. )
  900.  
  901. (defrule
  902.     (goal 1 10)
  903.     (goal rush-control RUSHING)
  904.     (difficulty <= hard)
  905.     (goal castle-attempt 2)
  906.     (unit-type-count villager > civ-dark-rush)
  907.     (building-type-count-total castle < 3)
  908.     (can-build-with-escrow castle)
  909. =>
  910.     (set-strategic-number sn-number-forward-builders 3)
  911. )
  912.  
  913. (defrule
  914.     (goal 1 10)
  915.     (or
  916.         (or
  917.             (unit-type-count transport-ship == 0)
  918.             (attack-soldier-count < ten-percent-pop)
  919.         )
  920.         (or
  921.             (or
  922.                 (unit-type-count villager < 10)
  923.                 (not (goal rush-control RUSHING) )
  924.             )
  925.             (or
  926.                 (goal military-parity NO)
  927.                 (town-under-attack)
  928.             )
  929.         )
  930.     )
  931.     (strategic-number sn-number-forward-builders >= 1)
  932. =>
  933.     (set-strategic-number sn-number-forward-builders 0)
  934. )
  935.  
  936. (defrule
  937.     (goal rush-control RUSHING)
  938.     (goal castle-attempt 2)
  939.     (difficulty <= hard)
  940.     (unit-type-count villager > civ-dark-rush)
  941.     (building-type-count-total castle < 3)
  942.     (can-build-with-escrow castle)
  943. =>
  944.     (release-escrow stone)
  945.     (build-forward castle)
  946. )
  947.  
  948. (defrule
  949.     (goal castle-attempt 2)
  950.     (difficulty <= hard)
  951.     (unit-type-count villager > civ-dark-rush)
  952.     (building-type-count-total castle < 3)
  953.     (can-build-with-escrow castle)
  954.     (nor
  955.         (goal wonder-attempt POSSIBLE)
  956.         (goal rush-control RUSHING)
  957.     )
  958. =>
  959.     (release-escrow stone)
  960.     (build castle)
  961. )
  962.  
  963. (defrule
  964.     (difficulty <= moderate)
  965.     (building-type-count barracks < 3)
  966.     (building-type-count barracks == 1)
  967.     (can-build barracks)
  968.     (or
  969.         (goal combat-arm INFANTRY)
  970.         (current-age == dark-age)
  971.     )
  972.     (or
  973.         (goal rush-control RUSHING)
  974.         (goal rush-control 2)
  975.     )
  976. =>
  977.     (build-forward barracks)
  978. )
  979.  
  980. (defrule
  981.     (difficulty <= moderate)
  982.     (building-type-count barracks < 3)
  983.     (current-age > feudal-age)
  984.     (can-build barracks)
  985.     (nor
  986.         (goal rush-control RUSHING)
  987.         (goal rush-control 2)
  988.     )
  989.     (or
  990.         (goal combat-arm INFANTRY)
  991.         (goal combat-supp INFANTRY)
  992.     )
  993. =>
  994.     (build barracks)
  995. )
  996.  
  997. (defrule
  998.     (goal rush-control RUSHING)
  999.     (difficulty <= moderate)
  1000.     (building-type-count archery-range == 1)
  1001.     (building-type-count-total market > 0)
  1002.     (can-build archery-range)
  1003.     (or
  1004.         (goal combat-arm CAVARCHER)
  1005.         (goal combat-arm ARCHER)
  1006.     )
  1007. =>
  1008.     (build-forward archery-range)
  1009. )
  1010.  
  1011. (defrule
  1012.     (difficulty <= moderate)
  1013.     (building-type-count archery-range < 3)
  1014.     (building-type-count-total market > 0)
  1015.     (can-build archery-range)
  1016.     (not (goal rush-control RUSHING) )
  1017.     (or
  1018.         (or
  1019.             (goal combat-arm CAVARCHER)
  1020.             (goal combat-arm ARCHER)
  1021.         )
  1022.         (or
  1023.             (goal combat-supp CAVARCHER)
  1024.             (goal combat-supp ARCHER)
  1025.         )
  1026.     )
  1027. =>
  1028.     (build archery-range)
  1029. )
  1030.  
  1031. (defrule
  1032.     (goal rush-control RUSHING)
  1033.     (difficulty <= moderate)
  1034.     (building-type-count stable == 1)
  1035.     (building-type-count-total university > 0)
  1036.     (can-build stable)
  1037.     (or
  1038.         (goal combat-arm CAVALRY)
  1039.         (goal combat-arm LIGHTCAV)
  1040.     )
  1041. =>
  1042.     (build-forward stable)
  1043. )
  1044.  
  1045. (defrule
  1046.     (difficulty <= moderate)
  1047.     (building-type-count stable < 3)
  1048.     (building-type-count-total university > 0)
  1049.     (can-build stable)
  1050.     (not (goal rush-control RUSHING) )
  1051.     (or
  1052.         (or
  1053.             (goal combat-arm CAVALRY)
  1054.             (goal combat-arm LIGHTCAV)
  1055.         )
  1056.         (or
  1057.             (goal combat-supp CAVALRY)
  1058.             (goal combat-supp LIGHTCAV)
  1059.         )
  1060.     )
  1061. =>
  1062.     (build stable)
  1063. )
  1064.  
  1065. (defrule
  1066.     (goal rush-control RUSHING)
  1067.     (difficulty <= hard)
  1068.     (building-type-count siege-workshop == 1)
  1069.     (can-build siege-workshop)
  1070.     (or
  1071.         (or
  1072.             (building-type-count-total archery-range > 1)
  1073.             (building-type-count-total castle > 1)
  1074.         )
  1075.         (or
  1076.             (building-type-count-total barracks > 1)
  1077.             (building-type-count-total stable > 1)
  1078.         )
  1079.     )
  1080. =>
  1081.     (build-forward siege-workshop)
  1082. )
  1083.  
  1084. (defrule
  1085.     (difficulty <= hard)
  1086.     (building-type-count siege-workshop == 1)
  1087.     (can-build siege-workshop)
  1088.     (or
  1089.         (or
  1090.             (building-type-count-total archery-range > 1)
  1091.             (building-type-count-total castle > 1)
  1092.         )
  1093.         (or
  1094.             (building-type-count-total barracks > 1)
  1095.             (building-type-count-total stable > 1)
  1096.         )
  1097.     )
  1098.     (not (goal rush-control RUSHING) )
  1099. =>
  1100.     (build siege-workshop)
  1101. )
  1102.  
  1103. ;**************************************
  1104. ;BASIC DIPLOMACY
  1105. #load-if-not-defined TEAMS-LOCKED
  1106. (defrule
  1107.     (current-age >= feudal-age)
  1108.     (players-stance any-computer-ally neutral)
  1109. =>
  1110.     (set-stance this-any-computer-ally neutral)
  1111. )
  1112.  
  1113. (defrule
  1114.     (current-age >= feudal-age)
  1115.     (players-stance any-computer-ally enemy)
  1116. =>
  1117.     (set-stance this-any-computer-ally enemy)
  1118. )
  1119.  
  1120. (defrule
  1121.     (current-age >= feudal-age)
  1122.     (players-stance any-computer-neutral ally)
  1123. =>
  1124.     (set-stance this-any-computer-neutral ally)
  1125. )
  1126.  
  1127. (defrule
  1128.     (current-age >= feudal-age)
  1129.     (players-stance any-computer-neutral enemy)
  1130. =>
  1131.     (set-stance this-any-computer-neutral enemy)
  1132. )
  1133.  
  1134. (defrule
  1135.     (current-age >= feudal-age)
  1136.     (players-stance any-computer-enemy ally)
  1137. =>
  1138.     (set-stance this-any-computer-enemy ally)
  1139. )
  1140.  
  1141. (defrule
  1142.     (current-age >= feudal-age)
  1143.     (players-stance any-computer-enemy neutral)
  1144. =>
  1145.     (set-stance this-any-computer-enemy neutral)
  1146. )
  1147.  
  1148. ;BASIC DIPLOMACY VS. HUMANS
  1149. ;if the human player doesn't go neutral at our request
  1150. (defrule
  1151.     (goal get-mad NO)
  1152.     (players-stance any-human-neutral enemy)
  1153.     (or
  1154.         (difficulty <= moderate)
  1155.         (current-age > dark-age)
  1156.     )
  1157. =>
  1158.     (chat-to-player-using-id this-any-human-neutral 22027)
  1159.         ;"I am Neutral to thee. Set thy diplomacy to Neutral to me."
  1160.     (disable-timer t-chathelp)
  1161.     (enable-timer t-chathelp 120)
  1162.     (set-goal get-mad ANGRY)
  1163. )
  1164.  
  1165. (defrule
  1166.     (not (goal get-mad NO) )
  1167.     (or
  1168.         (players-stance any-human-neutral neutral)
  1169.         (players-stance any-human-neutral ally)
  1170.     )
  1171. =>
  1172.     (chat-to-player-using-id this-any-human-neutral 22028)
  1173.     (chat-to-player-using-id this-any-human-neutral 22029)
  1174.         ;"Thou art wise to be a potential friend."
  1175.         ;"Thou shalt hear from me again."
  1176.     (disable-timer t-chathelp)
  1177.     (set-goal get-mad NO)
  1178. )
  1179.  
  1180. (defrule
  1181.     (goal get-mad ANGRY)
  1182.     (timer-triggered t-chathelp)
  1183.     (players-stance any-human-neutral enemy)
  1184. =>
  1185.     (set-goal get-mad ANGRIER)
  1186.     (disable-timer t-chathelp)
  1187.     (enable-timer t-chathelp 180)
  1188.     (chat-to-player-using-id this-any-human-neutral 22030)
  1189.     (chat-to-player-using-id this-any-human-neutral 22031)
  1190.         ;"Thou hast ignored my generous invitation. I am merciful, and give you another chance."
  1191.         ;"Set thy diplomacy to Neutral to me. Now."
  1192. )
  1193.  
  1194. (defrule
  1195.     (goal get-mad ANGRIER)
  1196.     (timer-triggered t-chathelp)
  1197.     (players-stance any-human-neutral enemy)
  1198. =>
  1199.     (set-goal get-mad ANGRIEST)
  1200.     (disable-timer t-chathelp)
  1201.     (enable-timer t-chathelp 180)
  1202.     (chat-to-player-using-id this-any-human-neutral 22032)
  1203.     (chat-to-player-using-id this-any-human-neutral 22033)
  1204.         ;"How unwise. Thou art still hostile to me. Set to Neutral at once versus me!"
  1205.         ;"This is thy last opportunity."
  1206. )
  1207.  
  1208. (defrule
  1209.     (goal get-mad ANGRIEST)
  1210.     (timer-triggered t-chathelp)
  1211.     (players-stance any-human-neutral enemy)
  1212. =>
  1213.     (set-goal personality 10)
  1214.     (disable-timer t-chathelp)
  1215.     (disable-self)
  1216. )
  1217.  
  1218. ;when an ally turns on us
  1219. (defrule
  1220.     (goal get-mad NO)
  1221.     (or
  1222.         (players-stance any-human-ally neutral)
  1223.         (players-stance any-human-ally enemy)
  1224.     )
  1225. =>
  1226.     (chat-to-player-using-id this-any-human-ally 22147)
  1227.         ;"I am thine Ally, friend. Pray set thine diplomacy to Ally, too."
  1228.     (disable-timer t-chathelp)
  1229.     (enable-timer t-chathelp 120)
  1230.     (set-goal get-mad ANGRY)
  1231. )
  1232.  
  1233. (defrule
  1234.     (not (goal get-mad NO) )
  1235.     (players-stance any-human-ally ally)
  1236. =>
  1237.     (chat-to-player-using-id this-any-human-ally 22148)
  1238.         ;"Thou art gracious to remain mine friend."
  1239.     (disable-timer t-chathelp)
  1240.     (set-goal get-mad NO)
  1241. )
  1242.  
  1243. (defrule
  1244.     (goal get-mad ANGRY)
  1245.     (timer-triggered t-chathelp)
  1246.     (or
  1247.         (players-stance any-human-ally neutral)
  1248.         (players-stance any-human-ally enemy)
  1249.     )
  1250. =>
  1251.     (set-goal get-mad ANGRIER)
  1252.     (disable-timer t-chathelp)
  1253.     (enable-timer t-chathelp 180)
  1254.     (chat-to-player-using-id this-any-human-ally 22149)
  1255.     (chat-to-player-using-id this-any-human-ally 22150)
  1256.         ;"What evil is this? Thou art still not friendly?!"
  1257.         ;"Perhaps thou didst not understand? Be mine Ally, for I am thine."
  1258. )
  1259.  
  1260. (defrule
  1261.     (goal get-mad ANGRIER)
  1262.     (timer-triggered t-chathelp)
  1263.     (or
  1264.         (players-stance any-human-ally neutral)
  1265.         (players-stance any-human-ally enemy)
  1266.     )
  1267. =>
  1268.     (set-goal get-mad ANGRIEST)
  1269.     (disable-timer t-chathelp)
  1270.     (enable-timer t-chathelp 180)
  1271.     (chat-to-player-using-id this-any-human-ally 22151)
  1272.     (chat-to-player-using-id this-any-human-ally 22152)
  1273.         ;"Oh, falsest of friends. This is thy last chance!"
  1274.         ;"If thou wilt have me for Ally, thou must do likewise."
  1275. )
  1276.  
  1277. (defrule
  1278.     (goal get-mad ANGRIEST)
  1279.     (timer-triggered t-chathelp)
  1280.     (or
  1281.         (players-stance any-human-ally neutral)
  1282.         (players-stance any-human-ally enemy)
  1283.     )
  1284. =>
  1285.     (set-goal personality 10)
  1286.     (disable-timer t-chathelp)
  1287.     (disable-self)
  1288. )
  1289.  
  1290. ;end result -- go hostile!!
  1291. (defrule
  1292.     (stance-toward any-human neutral)
  1293.     (nor
  1294.         (player-in-game any-computer-ally)
  1295.         (or
  1296.             (player-in-game any-computer-enemy)
  1297.             (player-in-game any-computer-neutral)
  1298.         )
  1299.     )
  1300. =>
  1301.     (chat-to-player-using-id this-any-human 22034)
  1302.     (chat-to-player-using-id this-any-human 22035)
  1303.         ;"I have thought better of mine previous merciful plan."
  1304.         ;"Thou must be exterminated, and I shall forever be thine foe."
  1305.     (set-stance this-any-human enemy)
  1306.     (set-stance every-computer ally)
  1307.     (set-goal personality 12)
  1308.     (disable-timer t-chathelp)
  1309.     (disable-timer t-chat)
  1310.     (disable-self)
  1311. )
  1312.  
  1313. (defrule
  1314.     (goal personality 10)
  1315.     (or
  1316.         (stance-toward any-human neutral)
  1317.         (stance-toward any-human ally)
  1318.     )
  1319. =>
  1320.     (chat-to-player-using-id this-any-human 22025)
  1321.     (chat-to-player-using-id this-any-human 22026)
  1322.         ;"So! Thou has chosen to defy me." 
  1323.         ;"It shall be war to the knife!"
  1324.     (set-stance this-any-human enemy)
  1325.     (set-stance every-computer ally)
  1326.     (disable-timer t-chathelp)
  1327.     (disable-timer t-chat)
  1328.     (disable-self)
  1329. )
  1330. #end-if
  1331. ;**************************************
  1332.